package com.kkb.hbase.mr.demo5GroupComparator;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * k2 v2
 * 按照orderID进行分区，保证相同的orderID进入统一分区（同一分区可能有多个OrderID）
 */
public class OrderPartitioner extends Partitioner<OrderBean, NullWritable> {
    @Override
    public int getPartition(OrderBean orderBean, NullWritable nullWritable, int numPartitions) {
        return orderBean.getOrderId().hashCode() % numPartitions;
    }
}
